<template>
  <div>
    <el-tabs v-model="activeName">
      <el-tab-pane v-for="(item,index) in newTabs" :key="index" :label="item.label" :name="item.name">
        <component :is="item.component"></component>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import attacheList from './components/attacheList'
import investigativeBodies from './components/investigativeBodies'
import { filterPermissionTebs } from '@/utils/util.js'
export default {
  components: { attacheList, investigativeBodies },
  data () {
    return {
      activeName: 'attacheList',
      tabList: [
        { label: '调查专员名单', component: 'attacheList', name: 'attacheList', refs: 'attacheList', isPermission: 'BEFORE_DQDCZY_TAB' },
        { label: '贷前调查机构名单', component: 'investigativeBodies', name: 'investigativeBodies', refs: 'investigativeBodies', isPermission: 'BEFORE_ORG_TAB' }
      ],
      newTabs: []
    }
  },
  mounted () {
    this.$nextTick(() => {
      this.init()
    })
  },
  methods: {
    init () {
      let res = filterPermissionTebs(this.tabList)
      this.newTabs = [...res.newTabs]
      this.activeName = res.activeName
    }
  }
}
</script>
